﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Touchscreen
{
    public class TicketManager
    {
        List<TicketType> ticketTypes;

        public List<TicketType> GetTicketTypes()
        {
            ticketTypes = new List<TicketType>();

            BioscoopMontiwaagEntities database = new BioscoopMontiwaagEntities();

            //var films = from f in database.film
            //            where f.status == "draait"
            //            orderby f.voorstelling.FirstOrDefault().datumtijd
            //            select f;
            //foreach (var f in films)
            //{
            //    Film film = new Film(f.naam,
            //        f.voorstelling.Single().datumtijd,
            //        f.voorstelling.Single().zaal_nummer,
            //        f.gesprokentaal,
            //        f.ondertiteling,
            //        f.ondertiteling,
            //        f.poster);
            //    Films.Add(film);
            //}

            var types = from tt in database.tickettype
                        orderby tt.prijs descending
                              select tt;
            foreach (var t in types)
            {
                TicketType ticket = new TicketType(t.naam, Math.Round(t.prijs, 2));
                ticketTypes.Add(ticket);
            }

            return ticketTypes;
        }
        /**
        //public void checkChairAvailability(int chairCount)
        //{
        //    SELECT COUNT(*)
        //    FROM ticket
        //}
         **/ 
    }
}